package com.copa.module.system.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.copa.domain.PageVo;
import com.copa.domain.ResponseDto;
import com.copa.module.system.domain.entity.AdminLogEntity;
import com.copa.module.system.mapper.AdminLogDao;
import com.copa.module.system.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author copa
 * @createDate 2021-02-25 15:09
 * @function
 */
@Service
public class LogServiceImpl implements LogService {

    @Autowired
    private AdminLogDao adminLogDao;

    @Override
    public ResponseDto<IPage<AdminLogEntity>> list(PageVo pageVo) {
        Page<AdminLogEntity> page = new Page<>(pageVo.getCurrent(), pageVo.getSize());
        IPage<AdminLogEntity> adminLogEntities = adminLogDao.findList(page);
        return ResponseDto.success(adminLogEntities);
    }

    @Override
//    @Transactional(rollbackFor = Exception.class)
    public void insert(AdminLogEntity log) {
        adminLogDao.insert(log);
    }
}
